package net.tools.web;

import java.io.*;

class TeeInputStream extends InputStream
{

	private InputStream in;

	private OutputStream out;

	void init(InputStream in, OutputStream out)
	{
		this.in = in;
		this.out = out;
	}

	public int read() throws IOException
	{
		int b = in.read();
		if(b >= 0)
			out.write(b);
		return b;
	}

	public int read(byte[] b, int off, int len) throws IOException
	{
		int l = in.read(b, off, len);
		if(l > 0)
			out.write(b, off, l);
		return l;
	}

}
